﻿//注册Vue全局组件
Vue.component("ue-editor", Vue.extend({
    template: `<div> 
                 <script id="ue-editor-script" type="text/plain"  style="width:1024px;height:500px;">{{editorcontent}}</script>
               </div> `, 
    props: {
        editorcontent: {
            type: String,
            default() { }
        },
    }, 
    mounted() {
        var _this = this;
      
        var ue = UE.getEditor('ue-editor-script');
        ue.addListener('blur', function (editor) {
            var html = ue.getContent();
            _this.$emit('change', html);
        });
    },
    watch: {
        editorcontent: function (val) {
            this.editorcontent = val;
            this.$nextTick(function () {
                var ue = UE.getEditor('ue-editor-script');
                ue.setContent(val);
            }); 
            }
        }
})); 